﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
using System.ComponentModel;
using Ppt = Microsoft.Office.Interop.PowerPoint;
using ObjectModel.PowerPoint.RulesModel;

namespace ObjectModel.PowerPoint.Old
{
    public class LinkedObjectCollection2 : ObservableCollection<LinkedObject>, INotifyPropertyChanged
    {
        LinkedObject mSelectedItem;

        [XmlIgnore]
        public LinkedObject SelectedItem
        {
            get { return mSelectedItem; }
            set
            {
                mSelectedItem = value;

                if (mSelectedItem != null)
                    Globals.PresentationEvents.RunWithoutEvents(mSelectedItem.Select);

                OnPropertyChanged(new PropertyChangedEventArgs("SelectedItem"));
            }
        }
        
        public void UpdateAll()
        {
            foreach (LinkedObject target in this)
                target.UpdateValue();
        }
    }
}
